<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Gradelevel as GradelevelModel;

/**
 * 年级接口
 */
class Gradelevel extends Api
{

    /**
     * 年级列表
     * @var array
     */
    protected $noNeedRight = '*';

    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new GradelevelModel();
    }

    /**
     * 查询年级表
     * @ApiTitle    (查询年级表)
     * @ApiParams (name="study_level_id", type="int", required=true, description="查询学段ID")
     * @ApiMethod  (GET)
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="查询成功")
     * @ApiReturn   ({
        'code':'200',
        'msg':'查询成功',
        'time': "",
        'data': $row
      })
     */
    public function gradeIndex()
    {
        $data = input('get.');
        $studyLevelId = $data['study_level_id'];
        if (empty($studyLevelId)) {
            $this->error('学段ID为空');
        }

        $dis = [
            'study_level_id' => $studyLevelId
        ];
        $row = $this->model->dataList($dis);      
        $this->success('查询成功', $row);
    }
   
}